<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<!-- HTML file produced from file: manual.tex --
 -- using Hyperlatex v 2.3.1 (c) Otfried Cheong--
 -- on Emacs 21.4 (patch 12) "Portable Code" XEmacs Lucid, Wed Jun  2 18:56:55 2004 -->
<HEAD>
<TITLE>Scheme 48 Manual -- Macros</TITLE>

</HEAD><BODY BGCOLOR="#ffffff">
<EM>Scheme 48 Manual</EM> | <A HREF="s48manual.html#top_node">Contents</A> | In Chapter: <A HREF="s48manual_24.html">Module system</A><BR>Previous: <A HREF="s48manual_27.html">Interfaces</A> | Next: <A HREF="s48manual_29.html">Higher-order modules</A>
<H2>Macros</H2>
<P>Hygienic macros, as described in
<A HREF="s48manual_90.html#2">[2]</A><A HREF="s48manual_90.html#3">[3]</A>, are implemented.
Structures may export macros; auxiliary names introduced into the
expansion are resolved in the environment of the macro's definition.
<P>For example, the <TT>scheme</TT> structure's <TT>delay</TT> macro 
is defined by the rewrite rule
<BLOCKQUOTE><PRE>
(delay <CODE><I>exp</I></CODE>)  <CODE>---&gt;</CODE>  (make-promise (lambda () <CODE><I>exp</I></CODE>)).
</PRE></BLOCKQUOTE>
The variable <TT>make-promise</TT> is defined in the <TT>scheme</TT>
structure's underlying package, but is not exported.  A use of the
<TT>delay</TT> macro, however, always accesses the correct definition
of <TT>make-promise</TT>.  Similarly, the <TT>case</TT> macro expands into
uses of <TT>cond</TT>, <TT>eqv?</TT>, and so on.  These names are exported
by <TT>scheme</TT>, but their correct bindings will be found even if they
are shadowed by definitions in the client package.
<P><P>
  
Previous: <A HREF="s48manual_27.html">Interfaces</A> | Next: <A HREF="s48manual_29.html">Higher-order modules</A></BODY></HTML>
